package com.reformer.commons.utils;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class HttpRequestor {

    /**
     * 获取所有request请求参数key-value
     *
     * @param request
     * @return
     */
    public static Map<String, String> getRequestParams(HttpServletRequest request) {
        Map<String, String> params = new HashMap<>();
        if (null != request) {
            for (String key : (Set<String>) request.getParameterMap().keySet()) {
                params.put(key, request.getParameter(key));
            }
        }
        return params;
    }
}